﻿using System;
using System.Web.Mvc;
using System.Web.Routing;
using YawetagLib.Facade;

namespace YawetagLib.Web.Controllers
{
    public sealed class ControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            return controllerType != null
                ? (IController)Activator.CreateInstance(controllerType, FacadeFactoryBuilder.GetFactory())
                : null;
        }
    }
}
